package xyz.hujf.base.ThreadWaitAndNotify;

/**
 * @author Hujf
 * @title: WaitTestNotifyInterupt
 * @date 2021-04-2118:56
 * @description: TODO
 */
public class WaitTestNotifyInterupt {
    static Object obj = new Object();

    public static void main(String[] args) throws InterruptedException {
        Thread threadA = new Thread(new Runnable() {
            @Override
            public void run() {
                System.out.println("---begin---");
                synchronized (obj){
                    try {
                        obj.wait();
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }

                System.out.println("---end---");
            }
        });

        threadA.start();
        Thread.sleep(1000);
        threadA.interrupt();
    }
}
